<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>

  </div>
  <script>
    var obj = {
      a:10,
      b:20
    }
    var proxy = new Proxy(obj,{
      get:function(target,prop){
     
        console.log('get触发了');
        return target[prop]
      },
      set:function(target,prop,value){
        console.log('set触发了')
        target[prop] = value
      }
    })

    console.log(proxy.a)
    proxy.a = 100
    console.log(proxy.a)
  </script>
</body>
</html>
